<template>
  <MailItem :mailModel="model"></MailItem>
</template>
<script>
import MailItem from '../components/MailItem.vue';
export default {
  components: {
    MailItem
  },
  data() {
    return {
      model: {
        messageId: '',
        accountName: '',
        templateName: '',
        data: '',
        title: '',
        sender: '',
        sendTime: '',
        receiver: '',
        ccList: '',
        bccList: '',
        body: '',
        exception: ''
      }
    };
  },
  computed: {
    messageId(){
      return this.$route.params.id;
    }
  },
  created() {
  },
  mounted() {
    this.loadObject();
  },
  methods: {
    loadObject() {
      this.$service.mail.sentItem({params: { messageId: this.messageId }}).then((response) => {
        if (response.success && response.data) {
          this.model = Object.assign(this.model, response.data);
        }
      });
    }
  },
};
</script>
